package com.lagou.email.lagouemail.dao;

import com.lagou.email.lagouemail.entity.LagouAuthCode;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface LagouAuthCodeDao {

    @Insert("insert into lagou_auth_code (email,code,createtime,expiretime) values (#{email},#{code},#{createtime},#{expiretime})")
    int insertEmailCode(LagouAuthCode lagouAuthCode);

    @Select("select * from lagou_auth_code where email=#{email} and code=#{code}  and expiretime>=now() limit 1")
    LagouAuthCode findByEmailCode(LagouAuthCode lagouAuthCode);
}
